//
//  SJTabBarController.m
//  penzer
//
//  Created by 还带大道 on 2018/11/14.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "SJTabBarController.h"
#import "SJNavigationController.h"
#import "SPUpcomingCenterTableViewController.h"
#import "SPDataCenterTableViewController.h"
#import "SPSettingTableViewController.h"

@interface SJTabBarController ()

@end

@implementation SJTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.customTabBar.item_font = [UIFont systemFontOfSize:10];
    self.customTabBar.item_textColor_nomal = RZ_COLOR(74, 74, 74);
    self.customTabBar.item_textColor_selected = RZ_COLOR(254, 220, 69);
    [self setupAllChildViewController];
    
}



/**初始化所有子控制器*/
- (void)setupAllChildViewController
{
    //待办中心
    SPUpcomingCenterTableViewController *upcoming = [[SPUpcomingCenterTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    upcoming.tabBarItem.tag = 0;
    [self childVC:upcoming title:@"待办中心" imageName:@"icon_upcoming" selectedImageName:@"icon_upcoming_selected"];

    //数据中心
    SPDataCenterTableViewController *data = [[SPDataCenterTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    data.tabBarItem.tag = 1;
    [self childVC:data title:@"数据中心" imageName:@"icon_data" selectedImageName:@"icon_data_selected"];

    //设置
    SPSettingTableViewController *setting = [[SPSettingTableViewController alloc] init];
    setting.tabBarItem.tag = 2;
    [self childVC:setting title:@"设置" imageName:@"icon_setting" selectedImageName:@"icon_setting_selected"];

}



- (void)childVC:(UIViewController *)vc title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName
{
    SJNavigationController *nav = [[SJNavigationController alloc] initWithRootViewController:vc];
    nav.navBarHairlineImageView.hidden = YES;
    [self setupChildViewController:nav title:title imageName:imageName selectedImageName:selectedImageName];
}


@end
